package com.shun.feign

import com.shun.entity.UserInfo
import com.shun.feign.FeignConfig
import org.springframework.cloud.netflix.feign.FeignClient
import org.springframework.web.bind.annotation.*

/**
 * Created by rainbow on 2017/6/15.
 *一事专注，便是动人；一生坚守，便是深邃！
 */
@FeignClient("user", url = "\${rainbow.api.user.url}", configuration = arrayOf(FeignConfig::class))
interface UserClient {

    //用户登录
    @RequestMapping("/api/v1/user/login", method = arrayOf(RequestMethod.POST))
    fun login(@RequestBody map: Map<String, String>): Map<String, Any?>

    //根据手机号码获取用户信息
    @RequestMapping("/api/account/{mobile}", method = arrayOf(RequestMethod.GET))
    fun get(@PathVariable("mobile") mobile: String): UserInfo?


    @RequestMapping("/api/account/register", method = arrayOf(RequestMethod.POST))
    fun create(@RequestBody params: Map<String, String>): UserInfo

    @RequestMapping("/api/account/active")
    fun active(@RequestParam("mobile") mobile: String, @RequestParam("client") client: String): UserInfo
}